<?php
/*
* @Created by Phpstorm
* @User: Zhangxinlei
* @Date: 
* @Time:
*/

namespace app\admin\controller\admin;



use app\admin\controller\Base;
use think\facade\Cache;
use think\facade\Request;
use think\facade\Db;
use app\common\model\AdminAdmin as M;
use app\common\service\AdminAdmin as S;
class Admin extends Base
{

    public function index()
    {
//        Cache::store('redis')->set('name','value',3600);
//        var_dump(Cache::get('name'));die;
        if (Request::isAjax()){
            return $this->getJson(M::getList());
        }
        return $this->fetch();
    }

    public function edit(){
        return $this->fetch();
    }

    public function add()
    {
        return $this->fetch();
    }

    /**
     * @return string
     * @content 分配权限
     */
    public function permission($id){
        if (Request::isAjax()) {
            return $this->getJson(S::goPermission(Request::post('permissions'),$id));
        }
        return $this->fetch('',M::getPermission($id));
    }

}